package com.example.service;

import com.example.entity.MedicalApproval;
import com.example.mapper.MedicalApprovalMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicalApprovalService {
    
    @Autowired
    private MedicalApprovalMapper medicalApprovalMapper;

    public void addMedicalApproval(MedicalApproval approval) {
        medicalApprovalMapper.insert(approval);  // 创建审批记录
    }

    public MedicalApproval getMedicalApprovalById(int id) {
        return medicalApprovalMapper.selectById(id);  // 查询审批记录
    }

    public List<MedicalApproval> getAllMedicalApprovals() {
        return medicalApprovalMapper.selectList(null);  // 查询所有审批记录
    }

    public void updateMedicalApproval(MedicalApproval approval) {
        medicalApprovalMapper.updateById(approval);  // 更新审批记录
    }

    public void deleteMedicalApproval(int id) {
        medicalApprovalMapper.deleteById(id);  // 删除审批记录
    }
}
